package com.ytjj.qmyx.admin.model.request;

import com.ytjj.qmyx.admin.model.CategoryNow;
import com.ytjj.qmyx.mall.model.ProductCategory;
import lombok.Data;

@Data
public class CategoryNowRequest extends CategoryNow {

    private Integer pageNum = 1;

    private Integer pageSize = 10;

    public CategoryNowRequest() {
    }

    public CategoryNowRequest(ProductCategoryRequest pcRequest){
        this.setTitle(pcRequest.getTitle());
        this.setId(pcRequest.getId());
        this.setStatus(pcRequest.getStatus());
        this.setPageSize(pcRequest.getPageSize());
        this.setPageNum(pcRequest.getPageNum());
        this.setPid(pcRequest.getPid());
        this.setCreateTime(pcRequest.getCreateTime());
        this.setUpdateTime(pcRequest.getUpdateTime());
        this.setIcon(pcRequest.getIcon());
    }

    public CategoryNowRequest(ProductCategory pcRequest){
        this.setTitle(pcRequest.getTitle());
        this.setId(pcRequest.getId());
        this.setStatus(pcRequest.getStatus());
        this.setPid(pcRequest.getPid());
        this.setCreateTime(pcRequest.getCreateTime());
        this.setUpdateTime(pcRequest.getUpdateTime());
        this.setIcon(pcRequest.getIcon());
    }

    public static CategoryNow setProductCategory(ProductCategory pcRequest){
        CategoryNow categoryNow =  new CategoryNow();
        categoryNow.setId(pcRequest.getId());
        categoryNow.setTitle(pcRequest.getTitle());
        categoryNow.setPid(pcRequest.getPid());
        categoryNow.setCreateTime(pcRequest.getCreateTime());
        categoryNow.setUpdateTime(pcRequest.getUpdateTime());
        categoryNow.setIcon(pcRequest.getIcon());
        categoryNow.setStatus(pcRequest.getStatus());
        return categoryNow;
    }

}
